home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 46
/
Amiga Format CD46 (1999-10-20)(Future Publishing)(GB)[!][issue 1999-12].iso
/
-serious-
/
misc
/
catmanged
/
scripts
/
cdtoct.ged
next >
Wrap
Text File
|
1999-09-06
|
3KB
|
94 lines
/*
** $VER: CDtoCT 1.0 (07.04.99)
**
** Script author: Damir Arh
**
** (C)1999 Digital Amiga Dream
**
**
** FUNCTION:
** ARexx-script for GoldEd.
** Converts catalog descriptions (*.cd) to catalog translations (*.ct).
** Doesn't dispose additional comments in the description files.
**
** USAGE:
** CDtoCT
**
** $HISTORY:
**
** 07.04.99 : 1.0 : First release
*/
OPTIONS RESULTS /* enable return codes */
if (LEFT(ADDRESS(), 6) ~= "GOLDED") then /* not started by GoldEd ? */
address 'GOLDED.1'
'LOCK CURRENT RELEASE=4' /* lock GUI, gain access */
if (RC ~= 0) then
exit
OPTIONS FAILAT 6 /* ignore warnings */
SIGNAL ON SYNTAX /* ensure clean exit */
/* ------------------------ INSERT YOUR CODE HERE: ------------------- */
'GOTO LINE=1 COLUMN=1' /* move to the beginning of the file */
'QUERY FILE VAR=Filename' /* get the filename, remove the extension */
Filename = left(Filename,lastpos('.',Filename))
'TEXT T=";" CR' /* some info on the converter */
'TEXT T="; ' || Filename || 'catalog" CR'
'TEXT T=";" CR'
'TEXT T="; catalog translation file created by CDtoCT" CR'
'TEXT T="; an ARexx script for GoldEd by Damir Arh" CR'
'TEXT T="; (c)1999 Digital Amiga Dream" CR'
'TEXT T=";" CR'
/* header */
'TEXT T="## version $VER: ' || Filename || 'catalog 0.0 ( . . )" CR'
'TEXT T="## codeset 0" CR'
'TEXT T="## language " CR'
'QUERY LINES VAR=NumLines' /* get the number of lines */
mode = 'comment' /* looking for the const name */
do until (NumLines = CurrLine)
'QUERY CODE VAR=CurrChar'
'QUERY LINE VAR=CurrLine'
if mode = 'comment' then do /* found the const name? */
if (CurrChar ~= c2d(';')) then do
'FIND STRING="(" NEXT QUIET'
'LEFT'
'DELETE EOL' /* remove parameters */
'FIRST'
mode = 'string' /* looking for the end of string */
end
end
else do
if (CurrChar = c2d(';')) then do /* end of string? */
mode = 'comment' /* looking for const name from now on */
end
end
'DOWN'
end
'QUERY DOC VAR=Filename' /* change the filename at the end */
Filename = left(Filename,lastpos('.',Filename))
'NAME NEW=' || Filename || 'ct'
/* ---------------------------- END OF YOUR CODE --------------------- */
'UNLOCK' /* VERY important: unlock GUI */
exit
SYNTAX:
SAY "Sorry, error line" SIGL ":" ERRORTEXT(RC) ":-("
'UNLOCK'
exit